package com.wuad.platformwuad.module.study.stringMethods;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * java 字符串操作方法
 */
@Slf4j
public class StringMethodsDemo {

    /**
     * startsWith，endsWith 是否已某个字符串开头或结尾
     */
    public static class start_endWith {
        public static void main(String[] args) {
            String s1 = "subbranchLeader";
            log.info("是否已某字符串开头:{}", s1.startsWith("sub"));
            log.info("指定下标是否是指定字符:{}", s1.startsWith("r",14));
            log.info("是否已某字符串结尾:{}", s1.endsWith("der"));
        }
    }

    /**
     * 将字符串转大小写
     */
    public static class up_lowCase {
        public static void main(String[] args) {
            String s1 = "SubBranchLeader";
            log.info("将字符串转小写：{}", s1.toLowerCase());
            log.info("将字符串转大写：{}", s1.toUpperCase());
        }
    }

//    public static void main(String[] args) {
//        String fileName = "last_#yyyyMMdd#.del";
//
//        String dataType = fileName.substring(fileName.indexOf("#") + 1, fileName.lastIndexOf("#"));
//        System.out.println(dataType);
//    }

//    public static void main(String[] args) {
//        String fileName = "last_#yyyyMMdd#.del";
//
//        System.out.println(fileName.contains("#"));
//    }


}
